import request from '@/utils/request'

export function login(params) {
  return request({
    url: '/api/v1.0/login',
    method: 'get',
    params: params
  })
}

export function register(data) {
  return request({
    url: '/api/v1.0/register',
    method: 'post',
    data: data
  })
}

export function editPassword(data){
  return request({
    url: `/api/v1.0/editPassword?userId=${data.userId}&oldpwd=${data.oldpwd}&newpwd=${data.newpwd}`,
    method: 'post'
  })
}

export function getUserInfo(data) {
  return request({
    url:`/api/v1.0/getUserInfo?userId=${data}`,
    method:'get'
  })
}

export function editUser(data) {
  return request({
    url: '/api/v1.0/editUser',
    method: 'post',
    data:data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
